//////////////////////////////////////////////////////////////////////////
// FileName:PageBase.cs
// CreateBy:Fenky
// CreateDate:2009-11-09
// Description:
//		Class PageBase,For Base Class
//      
// Modify Log:20091111 Add GetWorkFlowID Property 
//            20091112 Modify Current Directory Path
//	
// Copyright:ASL-MIS
/////////////////////////////////////////////////////////////////////////
using System;
using System.Web;
using System.Web.UI;
using System.Text;
using System.IO;
using Auto.Components;
using System.Xml;
namespace Auto.Web.Common
{
    /// <summary>
    /// Base Class
    /// </summary>
    public class PageBase : Page
    {
        /// <summary>
        /// Get Current Work Flow ID
        /// </summary>
        /// <returns></returns>
        public string GetWorkFlowID
        {
            get
            {
                string[] directorys = Path.GetDirectoryName(Request.FilePath).Split('\\');
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(string.Format(Server.MapPath("~/{0}/WorkFlow.xml"), directorys[directorys.Length - 1]));

                XmlNode node = xmlDoc.DocumentElement.SelectSingleNode(string.Format("//Page[@SysID='{0}'][@DivID='{1}'][@PageID='{2}']", SessionBox.CurrentSystem,
                    SessionBox.User.DivID, Path.GetFileName(Request.FilePath).ToLower()));
                string result = string.Empty;
                if (node != null)
                {
                    result = node.Attributes["WorkFlowID"].Value;
                }
                return result;
            }
        }
    }
}
